package cn.sheep.dolphin.bean

/**
  * author: old sheep
  * QQ: 64341393 
  * Created 2018/11/28
  */
class RichString(val str: String) {

	def toIntPlus = try {
		str.toInt
	} catch {
		case _: Exception => 0
	}

	def toDoublePlus = try {
		str.toDouble
	} catch {
		case _: Exception => 0d
	}
}

object RichString {
	/**
	  * 将string 隐式转换成richString
	  * @param str
	  * @return
	  */
	implicit def str2RichString(str: String) = new RichString(str)
}
